<template>
	<view class="majorsInfo" v-for="(majors,indexsub) in item.majorsInfo" :key="indexsub">
		<view class="flex-row center-row space-between text-majors-name">
			<view class="flex-column" :style="simplifyState == 1 ? 'width: 90%' : 'width: 100%'">
				<view class="flex-row flex-row-wrap" style="font-weight: bold;">
					<text v-if="majors.isNewly.length>0" style="margin-right: 14rpx;">新增</text>
					<text v-else style="margin-right: 14rpx;" :style="simplifyState==1 ? '' : 'color: #F8391D'">
						{{majors.chance + '%'}}
					</text>
					<text style="font-size: 28rpx;"
						:class="colorChange(majors.professionRealName,'elementTableMajor'+(majors.collegeEnrollCode + majors.majorCode +majors.groupCode))?'changeColor':''"
						:id="'elementTable|'+majors.professionRealName+'|'+(majors.collegeEnrollCode + majors.majorCode +majors.groupCode)"
						class="sousuo">
						{{majors.professionRealName}}
					</text>
					<view class="flex-row" v-if="simplifyState != 1">
						<view class="educational">
							<text>
								学制:
								<text class="text-222">
									{{ majors.learnYear }}年
								</text>
							</text>
						</view>
						<view class="educational">
							<text>
								学费:
								<text class="text-222">
									￥{{ majors.cost }}
								</text>
							</text>
						</view>
					</view>
				</view>

				<text v-if="simplifyState==1" class="one-school-city">{{majors.remarkExt}}</text>
				<view class="flex-column prompt" :style="simplifyState==1 ? '' : 'margin-top: 10rpx'">
					<view class="plan">
						<text>
							{{majors.planYear + '年计划:'}}
							<text class="text-464646" :class="majors.isFit==0?'changeColor':''">
								{{ majors.planNum + '人' }}
							</text>
							{{ majors.chooseSubjectText }}
						</text>
						<text>
							代码:
							<text class="text-464646">
								{{ majors.professionEnrollCode }}
							</text>
						</text>
					</view>

					<view class="money" v-if="simplifyState==1">
						<text>
							学制:
							<text class="text-464646">
								{{ majors.learnYear }}年
							</text>
						</text>
						<text>
							学费:
							<text class="text-464646">
								￥{{ majors.cost }}
							</text>
						</text>
					</view>
				</view>


				<view class="fromBox" v-if="simplifyState==1&&majors.moreYear.length>0&&majors.isNewly.length<=0">
					<view class="flex-row fromBox-head">
						<view style="font-size: 20rpx; width: 14%;" align="center">年份</view>
						<view style="font-size: 20rpx; width: 14%;" align="center">科类</view>
						<view style="font-size: 20rpx; width: 12%;" align="center">录取</view>
						<view style="font-size: 20rpx; width: 18%;" align="center">最低分</view>
						<view style="font-size: 20rpx; width: 24%;" align="center">最低位次</view>
						<view style="font-size: 20rpx; width: 29%;" align="center">
							<view class="th-item flex-row center-row" @tap.stop="popupMessage">
								<view>等效位差</view>
								<image src="https://mcdn.chatgk.com/xcx/static/images/zhinengtianbao/wenhao.png" mode=""
									style="width: 18rpx; height: 18rpx;"></image>
							</view>
						</view>
					</view>
					<view class="flex-row flex-row-table" v-for="(ele, index) in majors.moreYear" :key="index">
						<view style="font-size: 20rpx; width: 14%; height: 30rpx; line-height: 30rpx;" align="center">
							{{ ele.year || ' - ' }}
						</view>
						<view style="font-size: 20rpx; width: 14%; height: 30rpx; line-height: 30rpx" align="center">
							{{ele.course || ' - '}}
						</view>
						<view style="font-size: 20rpx; width: 12%; height: 30rpx; line-height: 30rpx" align="center">
							{{ ele.enterNum || ' - '}}
						</view>
						<view
							style="font-size: 20rpx; width: 18%; height: 30rpx; line-height: 30rpx; position: relative;"
							align="center">
							{{ ele.minScore || ' - ' }}
							<text v-if="ele.zjText&&ele.zjText.length>0" @tap="onzhengshowboxopen(ele.year)" class=""
								style="color: red;">
								征
							</text>
						</view>
						<view style="font-size: 20rpx; width: 24%; height: 30rpx; line-height: 30rpx" align="center">
							{{ ele.minRank || '-'}}
						</view>

						<view style="font-size: 20rpx; width: 29%; height: 30rpx; line-height: 30rpx;" align="center">
							<span v-if="ele.equivalentBitDifference == '-' || !ele.equivalentBitDifference">
								- </span>
							<span v-else-if="ele.equivalentBitDifference < 0" style="color: #FF7E36;">
								低{{ ele.equivalentBitDifference.toString().substring(1) }}</span>
							<span v-else-if="ele.equivalentBitDifference >= 0" style="color: #20ED33;">
								高{{ ele.equivalentBitDifference }}</span>
							&nbsp;
						</view>
					</view>
				</view>
			</view>
			<view class="table-list-paixu" v-if="simplifyState==1">
				<uni-icons type="top" size="20" :color="indexsub==0?'#eceded':''"
					@click="listpaixuMajor(1,majors,index,indexsub)"></uni-icons>
				<image @tap="onClickDeleteMajors(index, indexsub, '专业')" v-show="item.majorsInfo.length > 1"
					style="width: 50rpx; height: 50rpx;margin: 10rpx 0;"
					src="https://mcdn.chatgk.com/xcx/static/images/public/delete.png" mode="aspectFit"></image>
				<image class="disabled-img"
					src="https://mcdn.chatgk.com/xcx/static/images/scoreline/hostorydeleteIcon.png" mode=""
					style="width: 30rpx; height: 30rpx;margin: 10rpx 0;" v-show="item.majorsInfo.length == 1"></image>

				<uni-icons type="bottom" size="20" :color="indexsub == item.majorsInfo.length-1?'#eceded':''"
					@click="listpaixuMajor(2,majors,index,indexsub)"></uni-icons>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		name: "profession",
		props: {
			index: {
				type: Object,
			},
			item: {
				type: Object,
			},
			majorsInfo: {
				type: Object,
			},
			simplifyState: {
				type: Object
			},
		},
		data() {
			return {

			};
		},
		methods: {
			getMajorsTagText(val) {
				// this.$emit("getMajorsTagText", val, a)
				const lv = val.chance_lv
				let text = "风险极大"
				if (lv == 1) {
					text = "风险极大"
				} else if (lv == 2) {
					text = "风险一般"
				} else if (lv == 3) {
					text = "风险较小"
				}
				return text
			},
			colorChange(text, refVal) {
				this.$emit("colorChange", text, refVal)
			},
			popupMessage() {
				this.$emit("popupMessage")
			},
			onzhengshowboxopen(val) {
				this.$emit("onzhengshowboxopen", val)
			},
			listpaixuMajor(num, data, index, index2) {
				this.$emit("listpaixuMajor", num, data, index, index2)
			},
			onClickDeleteMajors(index, indexsub, val) {
				this.$emit("onClickDeleteMajors", index, indexsub, val)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.flex-row {
		display: flex;
		flex-direction: row;
	}

	.flex-column {
		display: flex;
		flex-direction: column;
	}

	.text-majors-name {
		color: #464646;
		font-size: 26rpx;

		// font-weight: bold;
		// margin: 25rpx 15rpx;
		.educational {
			background-color: #FEF0E5;
			font-size: 22rpx;
			border-radius: 3px;
			padding: 4rpx 8rpx;
			color: #FF3B0A !important;
			margin-left: 10rpx;
			font-weight: normal !important;
			display: flex;
			justify-content: start;
			align-items: center;

			.text-222 {
				font-weight: bold !important;
			}
		}

		.flex-row-wrap {
			flex-wrap: wrap;
		}
	}

	.text-majors-left {
		color: #464646;
		font-size: 20rpx;
		margin-top: 10rpx;
	}

	.one-school-city {
		font-weight: 400;
		color: #464646;
		font-size: 24rpx;
		margin: 10rpx 0;
	}

	.text-464646 {
		color: #464646;
		font-size: 24rpx;
		margin-top: 10rpx;
	}

	.fromBox {
		width: 100%;
		font-size: 12rpx;
		color: #666666;

		// display: flex;
		// flex-direction: row;
		.fromBox-head {
			color: #999999;
			margin: 8rpx 0 0 0;
			display: flex;
			flex-direction: row;
		}

		.from-table {
			width: 100% !important;
			overflow: hidden;
		}

		.flex-row-table {
			margin-top: 10rpx;
			display: flex;
			flex-direction: row;
		}

		.center-row {
			align-items: center;
		}
	}

	.th-item {
		font-size: 24rpx;
	}

	.difference {
		display: flex;
		flex-direction: row;
	}

	.table-list-paixu {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		position: relative;
	}

	.view-cell-line {
		height: 4rpx;
		background-color: #f8f8f8;
		width: 100%;
		border-radius: 2rpx;
		margin-top: 30rpx;
	}

	.majorsInfo {
		background-color: #F8F8F8;
		border-radius: 16rpx;
		padding: 16rpx 16rpx 16rpx 24rpx;
		margin: 32rpx 32rpx 24rpx 32rpx;

		.prompt {
			margin-top: -10rpx;
		}

		.plan,
		.money {
			display: flex;
			justify-content: start;
			align-items: center;
			font-size: 22rpx;
			// line-height: 32rpx;
			color: #999999;
			// margin: 0 0 0 0;

			text {
				display: inline-block;
			}

			.text-464646 {
				color: #464646;
				font-weight: bold;
				margin-right: 10rpx;
				font-size: 24rpx;
			}
		}
	}

	.majorsInfo:last-child {
		margin-bottom: 32rpx;
	}
</style>